import fetch from 'common/src/utils/fetch';


/**
 * 查询培训信息列表
 */
export function queryTrainingInfoList (data = {}) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage/listPage',
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    data
  });
}


/**
 * 保存培训信息
 */
export function addTrainingInfo (data) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage',
    method: 'POST',
    data
  });
}


/**
 * 更新培训信息
 */
export function updateTrainingInfo (data) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage',
    method: 'PUT',
    data
  });
}


/**
 * 删除培训信息
 */
export function deleteTrainingInfo (id) {
  return fetch({
    url: `/api/textbookservice/trainingInfoManage/${id}`,
    method: 'DELETE',
    headers: { 'Content-Type': 'application/json' }
  })
}


/**
 * 根据培训信息ID查询详情（原对象）
 */
export function findTrainingInfo (id) {
  return fetch({
    url: `/api/textbookservice/trainingInfoManage/${id}`,
    method: 'GET',
    headers: { 'Content-Type': 'application/json' }
  })
}

/**
 * 根据培训信息ID查询详情（Vo对象）
 */
export function findTrainingInfoDetail (id) {
  return fetch({
    url: `/api/textbookservice/trainingInfoManage/detail/${id}`,
    method: 'GET',
    headers: { 'Content-Type': 'application/json' }
  })
}

/**
 * 提交培训信息
 */
export function submitTrainingInfo(data) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage/submit',
    method: 'POST',
    data
  });
}

/**
 * admin提交培训信息
 */
export function submitTrainingInfoByadmin(data) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage/adminSubmit',
    method: 'POST',
    data
  });
}

/**
 * 下载培训信息导入模板
 */
export function downTemplate() {
  return '/api/textbookservice/trainingInfoManage/template';
}

/**
 * 导入培训信息
 */
export function importTrainingInfos() {
  return '/api/textbookservice/trainingInfoManage/import';
}

/**
 * 导出培训信息清单
 */
export function exportList(data) {
  return fetch({
    url: '/api/textbookservice/trainingInfoManage/export',
    method: 'post',
    showMask: false,
    data
  });
}

/**
 * 查询马工程课程信息
 */
export function findMaCourses(data) {
  return fetch({
    url: '/api/textbookservice/marxistEngineering/findMaCourses',
    method: 'POST',
    data
  });
}

/**
 * 根据课程code查询对应的马工程教材信息
 */
export function findMaTextBooksByCourses(data) {
  return fetch({
    url: '/api/textbookservice/marxistEngineering/findMaTextBooksByCourses',
    method: 'POST',
    data
  });
}
